# coding:utf-8
import face_recognition
import cv2
# #输入已知图片biden.jpg
# known_image = face_recognition.load_image_file("faces/Liulu.jpg")
# #输入待识别的图片unknown.jpg
# unknown_image = face_recognition.load_image_file(".jpg")

# biden_encoding = face_recognition.face_encodings(known_image)[0]
# unknown_encoding = face_recognition.face_encodings(unknown_image)[0]

# results = face_recognition.compare_faces([biden_encoding], unknown_encoding)
# #输出的results是一串Boolean值
# print results

picture_path = "faces/Xu.jpg"

image = face_recognition.load_image_file(picture_path)
face_locations = face_recognition.face_locations(image)
if len(face_locations):
    print(face_locations)
    img = cv2.imread(picture_path)
    img = cv2.resize(img,)
    cv2.imshow("original", img)
    img_roi = img[face_locations[0][0]:face_locations[0][1], face_locations[0][2]:face_locations[0][3]]
    # cv2.imshow("face", img_roi)
    cv2.waitKey(10000)
    cv2.destroyAllWindows
else:
    print("没有检测到人脸")